package com.fafa.swing.base;

import javax.swing.*;

/**
 * @author : fafa
 * @version V1.0
 * @Project: SwingTest
 * @Package com.fafa.swing
 * @Description: JListDemo1 单选
 * @date Date : 2019年11月24日 16:31
 */
public class JListDemo1 extends JFrame {
    public static void main(String[] args){

        JFrame jFrame = new JFrame("列表框组件示例");
        JPanel jPanel = new JPanel();
        JLabel jLabel = new JLabel("证件类型：");
        String[] items = new String[] {"身份证","驾驶证","军官证"};
        JList jList = new JList(items);
        jPanel.add(jLabel);
        jPanel.add(jList);
        jFrame.add(jPanel);
        jFrame.setBounds(300,200,400,200);
        jFrame.setVisible(true);
        jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    }
}
